package com.novax.ex.activity.provider.service;

import com.novax.ex.activity.infrastructure.entity.EventSignup;
import com.novax.ex.activity.infrastructure.entity.OperationConfigExpand;
import com.novax.ex.activity.infrastructure.entity.OperationUserCount;
import com.novax.ex.activity.infrastructure.entity.OperationUserLog;
import com.novax.ex.activity.infrastructure.mapper.OperationConfigMapper;
import com.novax.ex.activity.infrastructure.mapper.OperationUserLogMapper;
import com.novax.ex.common.base.BaseMapper;
import com.novax.ex.common.base.BaseService;
import org.springframework.stereotype.Service;

import jakarta.annotation.Resource;
import java.util.List;

/**
 * @Description 活动落地页配置
 * @Author ChenXi
 * @Date 2023/04/18/10:08
 */

@Service
public class OperationConfigService extends BaseService {

    @Resource
    private OperationConfigMapper operationConfigMapper;
    @Resource
    private OperationUserLogMapper operationUserLogMapper;

    @Override
    protected BaseMapper getBaseMapper() {
        return operationConfigMapper;
    }

    /**
     * @Description: 查询是否次自定义ID是否已存在
     * @Author: ChenXi
     * @Date:  2023/4/18 15:40
     * @param customId
     * @return: java.lang.Integer
     **/
    public Long findByCustomId(String customId) {
        return operationConfigMapper.findByCustomId(customId);
    }

    /***
     * @Description: 查询详情
     * @Author: ChenXi
     * @Date:  2023/4/19 10:23
     * @param customId
     **/
    public OperationConfigExpand findByCustomIdAndLanguage(String customId, String language) {
        return operationConfigMapper.findByCustomIdAndLanguage(customId, language);
    }

    /***
     * @Description: 查询详情(查不到语言仍会返回)
     * @Author: ChenXi
     * @Date:  2023/4/19 10:23
     * @param customId
     **/
    public OperationConfigExpand findByCustomIdIgnoreLanguage(String customId, String language) {
        return operationConfigMapper.findByCustomIdIgnoreLanguage(customId, language);
    }


    /**
     * 24小时内活动报名人数
     *
     * @return 报名人数
     */
    public List<OperationUserCount> countUserId (List<Long> operationIds) {
        return operationUserLogMapper.countUserId(operationIds);
    }
}
